#region

using System.Text.RegularExpressions;

#endregion

namespace Vin.Tool.Core.AssertCategory;

public class RegexTool
{
    #region 基础校验

    /// <summary>
    /// 是否是手机号
    /// </summary>
    public static bool IsMobile(string? mobile)
    {
        if (string.IsNullOrEmpty(mobile))
        {
            return false;
        }

        return Regex.IsMatch(mobile, @"^1[3456789]\d{9}$");
    }

    /// <summary>
    /// 是否是邮箱
    /// </summary>
    public static bool IsEmail(string? email)
    {
        if (string.IsNullOrEmpty(email))
        {
            return false;
        }

        return Regex.IsMatch(email, @"^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$");
    }

    #endregion
}